package middleware

import (
	"github.com/atreugo/cors"
	"github.com/savsgio/atreugo/v11"
)

func Cors() atreugo.Middleware {
	return cors.New(cors.Config{
			AllowedOrigins:   []string{"*"},
			AllowedHeaders:   []string{"Content-Type", "X-Custom", "Token", "Authorization"},
			AllowedMethods:   []string{"GET", "POST", "PUT", "DELETE"},
			ExposedHeaders:   []string{"Content-Length", "Authorization"},
			AllowCredentials: true,
			AllowMaxAge:      3600,
		})
}

